﻿using System;
using System.Collections.Generic;
using Jayden.Dll.Web.HtmlControls.Descriptions;
using Jayden.Dll.Web.HtmlControls.Generics;

namespace Jayden.Dll.Web.HtmlControls
{
	public class Legend: HtmlElement
	{
		public Legend() : base(LegendDescription.Instance) { }
		public Legend(string text, bool htmlEncode = true)
			: base(LegendDescription.Instance)
		{
			if (!string.IsNullOrWhiteSpace(text))
				AddText(text, htmlEncode);
		}
	}
	public class LegendDescription : HtmlElementDescription
	{
		public static readonly LegendDescription Instance = new LegendDescription();
		private LegendDescription() : base("legend") { }
		public override Type ControlType { get { return typeof(Legend); } }
		public override bool OnlyPhrasingContent { get { return true; } }
		public override string Description { get { return "title or explanatory caption for the rest of the contents of the legend element’s parent element."; } }
		public override IEnumerable<HtmlElementDescription> PermittedParents { get { yield return FieldsetDescription.Instance; } }
	}
}
